<template>
  <div class="textDetail">
  	<text-header :title="''" :bgcolor="'rgba(255,255,255,1)'" :color="'#808080'" :topath="'/recommend'" class="textHeader"></text-header>
  	<div class="line"></div>
  	<div class="text-model">
  		<div class="text-title">
  			{{textInfo.title}}
  		</div>
  		<div class="time">
  			{{textInfo.createDate}}
  		</div>
  		<div class="text-con" v-html="textInfo.content"></div>
  	</div>
  </div>
</template>

<script>
import textHeader from "../components/TextHeader";
import URL from "@/until/urlConfig.js"
import until from "@/until/until.js"
export default {
  name: 'TextDetail',
  components: {
  	textHeader
  },
  data(){
  	return{
  		textInfo:{
  			title:'',
  			createDate:'',
  			content:''
  		}
  	}
  },
  beforeRouteLeave(to, from, next) {
	// 设置下一个路由的 meta
	console.log(to.meta);
	to.meta.keepAlive = true; // C 跳转到 A 时让 A 不缓存，即刷新
	next();
  },
  methods:{
  	getKnowledgeDetail(){
  		var id = this.$route.query.id;
  		until.$http.post(URL.getKnowledgeDetail,{id:id})
  		.then(res => {
  			this.textInfo = res.data&&res.data.length>0?res.data[0]:{}
  		})
  	}
  },
  created(){
  	this.getKnowledgeDetail();
  }
}
</script>
<style lang="scss">
@import "../style/public.scss";
.textDetail{
	background:#fff;
	height:100%;
	.detailHeader{
		border-bottom:rem(2) solid #f1f1f1;
	}
	.line{
		height:rem(2);
		background:#f1f1f1;
		width:calc(100% - 0.53333rem);
		margin:0 auto;
	}
	.text-model{
		color:#808080;
		padding:rem(20);
		height:calc(100% - 0.98667rem);
		overflow:auto;
		.text-title{
			font-size:rem(32);
			text-align:left;
		}
		.time{
			margin:rem(25) 0 rem(52);
			text-align:left;
			font-size:rem(24);
			color:#c8c8c8;
		}
		.text-con{
			font-size:rem(28);
			text-align:left;
		}

	}
}
</style>
